package lumis.portal.monitor.impl;

import java.util.Collection;

import lumis.portal.PortalException;
import lumis.util.ITransaction;

/**
 * Interface definition for the DAO responsible by collecting measures. 
 *
 * @version $Revision: 9601 $ $Date: 2008-07-18 15:38:17 -0300 (Fri, 18 Jul 2008) $
 * @since 4.2.0
 */
interface ICollectedMeasureDao
{
	/**
	 * Returns a collection of {@link CollectedMeasure} for consolidation process.
	 * All collected measures returned belongs to the same {@link EventData}
	 * and {@link MeasureType}. The query is executed with upgrade lock.
	 * @param transaction the transaction for persistence access.
	 * @return a collection of collected measures for consolidation process,
	 * or an empty collection if none was found.
	 * @since 4.2.0
	 */
	public Collection<CollectedMeasure> getConsolidationCollection(ITransaction transaction) 
			throws PortalException;

	/**
	 * Deletes a collection of {@link CollectedMeasure} from the persistence.
	 * @param collectedMeasures the collected measures to be deleted.
	 * @param transaction the transaction for persistence access.
	 * @since 4.2.0
	 */
	public void deleteCollectedMeasures(Collection<CollectedMeasure> collectedMeasures, 
			ITransaction transaction) throws PortalException;

	/**
	 * Persists the given collected measure as the specified measure type.
	 * @param collectedMeasure the collected measure. If the measureTypeId 
	 * property is not set, the measure type must be specified by the 
	 * <code>measureTypeKey</code> argument.
	 * @param measureTypeKey the measure type's key. May be null if 
	 * the given collectedMeasure has its measureTypeId property set.
	 * @param transaction the transaction for persistence access. If 
	 * <code>null</code>, the implementation must create a transaction for this operation.
	 * @since 4.2.0
	 */
	public void persistCollectedMeasure(CollectedMeasure collectedMeasure, 
			String measureTypeKey, ITransaction transaction) throws PortalException;

}